package util

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
)

/**
 * @File : errRespon.go
 * @Description : 错误返回公共函数
 * @Author : chen
 * @Date : 2024/4/17
 */

func ErrContextRespon(c *gin.Context, err error, message string) {
	c.JSON(http.StatusInternalServerError, gin.H{
		"isSuccess": false,
		"msg":       message + ": " + err.Error(),
	})
}

func ErrPrintRespon(message string, err error) {
	fmt.Println(message, "err: ", err)
}